#include <string>
#include <vector>
#include <iostream>
#include <memory>
#include "Controller.h"
#include "StoreObject.h"
#include "MetaObject.h"
#include "MetaObjectIO.h"
#include "Transaction.h"
using namespace gitstore;
using namespace std;
int test() {
    return 0;
}
int main() {
    vector<string> vds,vbr,vvs;

    StoreObject value("haha");
    StoreObject value2("hehe");
    StoreObject value3("hahg");
    CObjectController op;
//    shared_ptr<CMetaDataIOBase> io_worker= make_shared<CMockMetaDataIO>();
//    Transaction<decltype(&CObjectController::test_template)>::runTransaction(io_worker, &CObjectController::test_template, &op);
    auto res = Transaction<decltype(&CObjectController::createObject)>::runTransaction(&CObjectController::createObject, &op, "ds1","test","master","test","test",value);
//    auto res = op.createDataset("ds1","test","master","test","test",value);
    res = op.branchObject("ds1", "master", "dev", "testdev");
    Branch branch;
    op.getBranchInfo("ds1", "master", branch);
    std::string cur_version;
    res = op.putValue("ds1", "master", value2, "testput", branch.cur_version,cur_version);

    res = op.branchObject("ds1", "master", "dev", "testdev");
    op.getBranchInfo("ds1", "dev", branch);
    res = op.putValue("ds1", "dev", value3, "testdevput", branch.cur_version,cur_version);
    res = op.mergeBranch("ds1", "master", "dev", "mergetest", "");
//    op.branchDataset("ds1", "master", "dev", "testdev2");
    res = op.listObject(vds);
    res = op.listObjectBranches("ds1", vbr);
    res = op.listObjectVersions("ds1", vvs);
    Node node;
    res = op.getNodeInfo("ds1", "dev", node);


    res = op.getBranchVersions("ds1", "dev", vvs);
    string sres;
    res = op.diffObjectBranch("ds1", "master", "ds1", "dev", "", sres);
    return 0;
}
